/*
 *  obstacleMap.h
 *  rovercontrol08
 *
 *  Created by David Miller on 7/28/08.
 *  Copyright 2008 University of Oklahoma. All rights reserved.
 *
 */

/* This maintains a decimeter resolution sparse grid map of the 2*MAXDISTMAP meters of the obstacles around the rover.
 */



//**************Globals***********
obstacleCell Obstacles[MAXNUMOBSTACLES];

//****Function prototypes*********

//integer absolute value
int abs(int x);

//returns 1 if obstacle is merged with existing obstacle, 0 if similarly placed obstacle does not already exist.
//checks active points to see if they should be deactivated
//note that it aonly checks the full list if there is not an obstacle that merges
int mergeObstacle(roverProperties *rover, Point3D obst);

// this function deactivates obstacles out of range, tries to merge new obstacle with existing active obstacles
// and then tries to add this obstacle as a new obstacle to the map
// returns 0 if map is full, -1 if merged and 1 if added.
int addObstacle(roverProperties *rover, Point3D obst);
